ReadOnly Generic Method

Wintellect PowerCollections

Collapse imageExpand ImageCollapseAll imageExpandAll imageDropDown imageDropDownHover imageCopy imageCopyHover image
[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

Returns a read-only view onto a dictionary. The returned IDictionary<TKey,TValue> interface only allows operations that do not change the dictionary. The IsReadOnly property returns true, indicating that the dictionary is read-only. All other methods on the interface throw a NotSupportedException.

Namespace: Wintellect.PowerCollections
Assembly:  PowerCollections (in PowerCollections.dll)

Syntax

C#
public static IDictionary<TKey, TValue> ReadOnly<TKey, TValue>(
	IDictionary<TKey, TValue> dictionary
)
Visual Basic (Declaration)
Public Shared Function ReadOnly(Of TKey, TValue) ( _
	dictionary As IDictionary(Of TKey, TValue) _
) As IDictionary(Of TKey, TValue)
Visual C++
public:
generic<typename TKey, typename TValue>
static IDictionary<TKey, TValue>^ ReadOnly (
	IDictionary<TKey, TValue>^ dictionary
)

Parameters

dictionary
IDictionary<(Of <TKey, TValue>)>
The dictionary to wrap.

Return Value

A read-only view onto dictionary. Returns null if dictionary is null. If dictionary is already read-only, returns dictionary.

Type Parameters

TKey
TValue

Remarks

The data in the underlying dictionary is not copied. If the underlying dictionary is changed, then the read-only view also changes accordingly.

See Also